﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using System.ComponentModel;
using System.Collections.ObjectModel;

namespace App6._12
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
    }

    public class SysInfoCollection : ObservableCollection<SystemInfo>
    {
        public SysInfoCollection()
        {
            SystemInfo info = new SystemInfo();
            info.Temperature = 29.1;
            Add(info);

            info = new SystemInfo();
            info.Temperature = 29.6;
            Add(info);

            info = new SystemInfo();
            info.Temperature = 29.3;
            Add(info);
        }
    }

    public class SystemInfo : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string propName)
        {
            if (this.PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }

        double _temperature;

        public double Temperature
        {
            get { return this._temperature; }
            set
            {
                this._temperature = value;
                OnPropertyChanged("Temperature");
            }
        }
    }
}
